package demoinner;


class OuterClass{
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    class InnerClass2{
        public int data4 = 4;
        public int data1 = 999999;
        private int data5 = 5;
        public static int data6 = 6;


        public void testInner2(){
            System.out.println("实例内部方法");
            System.out.println(data1);
            System.out.println(OuterClass.this.data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);

        }
    }

    static class InnerClass{
        public int data1 = 99999;
        public static int data3 = 3333;
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;

        public void testInner(){
            System.out.println("inclass");
            System.out.println(data1);
            //System.out.println(data2);
            System.out.println(data3);
            System.out.println(OuterClass.data3);
        }
    }

    public void test(){
        System.out.println("outclass");
    }
}

class OuterClass3{
    public void test(){
        class A{
            public int data1 = 1;
        }
        A a = new A();
        System.out.println(a.data1);
    }
}
interface Greeting {
    void greet();
}

public class Test {
    public static void main(String[] args) {
        Greeting g = new Greeting(){

            @Override
            public void greet() {
                System.out.println("haha");
            }
        };
        g.greet();

    }
    public static void main2(String[] args) {
        OuterClass outerclass = new OuterClass();
        OuterClass.InnerClass2 innerclass2 = outerclass.new InnerClass2();
        innerclass2.testInner2();
    }
    public static void main1(String[] args) {
        OuterClass.InnerClass innerclass = new OuterClass.InnerClass();
        innerclass.testInner();
    }

}
